package com.controller;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.service.UserCreationService;

@Component
@ManagedBean(name = "registerBean")
@RequestScoped
public class RegisterBean {
	private String userName = null;

	private String password = null;

	@Autowired
	private UserCreationService userCreationService;

	public String register() {
		userCreationService.createUser(this.getUserName(), this.getPassword());
		return "login?faces-redirect=true";
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}
